/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kedacom.demo.spring.event;

import com.kedacom.demo.spring.aware.SpringApplicationContextAware;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.stereotype.Component;

/**
 *
 * @author xiaojinghai
 */
@Component
public class PublishMyEventBean extends SpringApplicationContextAware {

    @PostConstruct
    public void init() {
        this.publishEvent(new MyEvent(this, "Bean初始化"));
    }

    public void doSomething() {
        this.publishEvent(new MyEvent(this, "Bean方法调用"));
    }

    @PreDestroy
    public void dostory() {
        this.publishEvent(new MyEvent(this, "Bean销毁"));
    }
}
